package com.smartEdu.controller.app;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.smartEdu.commons.LogCvt;
import com.smartEdu.commons.Session;
import com.smartEdu.commons.Tag_Tips;
import com.smartEdu.exception.RequestException;
import com.smartEdu.exception.ServiceException;
import com.smartEdu.model.RecommendFriendModel;
import com.smartEdu.response.Response;
import com.smartEdu.service.HomeWorkService;
import com.smartEdu.service.RecommendFriendServie;

@Controller
@RequestMapping(value="/app")
public class RecommendFriendController extends AppBaseController{
	@Autowired
	@Qualifier(value="appresponse")
	public Response respContext;
	
	@Autowired
	@Qualifier(value="recommendfriendserviceimpl")
	public RecommendFriendServie recommendfriendservice;
	
	@Override
	public String GetRespContent(Session sess) {
		// TODO Auto-generated method stub
		return respContext.GetRespContent(sess);
	}

	@RequestMapping(value="/rongcloude/recommend")
	public void recommendfriend(HttpServletRequest request,HttpServletResponse response ){
        Session sess=null;
//		Session sess=new Session();
//		List<RecommendFriendModel> models=null;
//		List<Map<String,Object>> list=null;
//		Map<String,Object> map1=new HashMap<>();
//		Map<String,Object> map2=new HashMap<>();
//		map1.put("id", "140202021028");
//		map1.put("name", "魏胜兴");
//		map1.put("RNTOken",com.smartEdu.RongYun.GetRongYunToken.GetRongCloudToken("140202021028"));
//		
//		map2.put("id", "140202021029");
//		map2.put("name", "许伟杰");
//		map2.put("RNTOken",com.smartEdu.RongYun.GetRongYunToken.GetRongCloudToken("140202021029"));
//		list.add(map1);
//		list.add(map2);
//		sess.put("recommendfriend", list);
//		sess.put(Tag_Tips.RESPCODE,Tag_Tips.OK);
//		SetResponse(response, sess);
		try {
			sess=GetSession();
			sess.put(Tag_Tips.REQUEST, GetParameter(request));
			 recommendfriendservice.recommend(sess);
		} catch (RequestException e) {
			LogCvt.error(" 请求异常");
		}
		catch (Exception e) {
			LogCvt.error("获取request异常111");
		}
		finally {
			SetResponse(response, sess);
		}
	}


}
